﻿using Models.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace yymbDAL
{
   public class PsdataService
    {
        private yymbDBEntities db;
        public PsdataService() {
            db = new yymbDBEntities();
        }
        /// <summary>
        /// 个人信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool informations(Information information)//保存修改
        {
            db.Entry(information).State = System.Data.Entity.EntityState.Modified;
            
            if (db.SaveChanges()>0)
            {
                return true;
            }
            return false;
        }


        /// <summary>
        /// 注册信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool users(User user)//保存修改
        {
            db.Entry(user).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
            if (db.SaveChanges() > 0)
            {
                return true;
            }
            return false;
        }
        /// <summary>
        /// 学历信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool educations(Education education)//保存修改
        {
            db.Entry(education).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
            if (db.SaveChanges() > 0)
            {
                return true;
            }
            return false;
        }

        /// <summary>
        /// 职业信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>

        public bool occupations(Occupation occupation)//保存修改
        {
            db.Entry(occupation).State = System.Data.Entity.EntityState.Modified;

            if (db.SaveChanges() > 0)
            {
                return true;
            }
            return false;
        }
        /// <summary>
        /// 个性标签
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public List<Personality_tag> personality_Tag(int id)
        {
            return db.Personality_tag.Where(s => s.UserID == id).ToList();
        }
    }
}
